#include <iostream>
#include <iomanip>
#include "Watch.h"
using namespace std;



int it_F(int x)
{
	int f = 1;
	for(int i = 1; i <= x; i++)
	{
		f = f*i;
	}
	return f;
}

int re_F(int x)
{
	if(x == 0)
		return 1;
	else
		return x*re_F(x-1);
}


int main()
{
	cout << it_F(5) << endl;
	cout << re_F(5) << endl;

	Course::Watch w;
	int nLoop = 1000000;
	cout << "REKURSIVT";
	w.restart();
	for (int i = 0; i < nLoop; i++)
	{
		int x = re_F(5);
	}
	Course::microseconds t0;
	t0 = w.elapsedUs();
	cout  << setw(15) << t0.count() / double(nLoop) << "Us" << endl;
	
	cout << "INTERATIVT";
	w.restart();
	for (int j = 0; j < nLoop; j++)
	{
		int y = it_F(5);
	}
	Course::microseconds t1;
	t1 = w.elapsedUs();
	cout  << setw(15) << t1.count() / double(nLoop) << "Us" << endl;
	cin.get();
}